/**
 * @file pedometer.h
 *
 */
#ifndef PEDOMETER_H
#define PEDOMETER_H

#ifdef __cplusplus
extern "C" {
#endif

/*********************
 *      INCLUDES
 *********************/

#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lvgl.h"
#include "lv_watch_conf.h"
#else
#include "../../../lvgl/lvgl.h"
#include "../../../lv_watch_conf.h"
#endif

#if USE_LV_WATCH_PEDOMETER != 0

/*********************
 *      DEFINES
 *********************/

/**********************
 *      TYPEDEFS
 **********************/
typedef struct {
    lv_watch_obj_ext_t lv_watch_obj;
    /*New data for this type */
    lv_obj_t * label;
    uint8_t height;
    uint8_t weight;
    uint16_t step;
    lv_obj_t * info_roller;
    lv_obj_t * info_label;
    char sel_str[6];
} lv_bodyinfo_ext_t;

typedef struct {
    lv_cont_ext_t old_ext;
    lv_obj_t * pedometer_dot;
    lv_obj_t * pedometer_cont;
    lv_obj_t * pedometer_goal;
} lv_pedometer_ext_t;

/**********************
 * GLOBAL PROTOTYPES
 **********************/
lv_obj_t * pedometer_create(lv_obj_t * tileview, uint16_t id);
lv_obj_t * bodyinfo_create(lv_obj_t * tileview, uint16_t id);
lv_obj_t * record_create(lv_obj_t * tileview, uint16_t id);
void pedometer_set_steps(uint16_t steps);
void pedometer_set_goalsteps(uint16_t goal);
uint16_t pedometer_get_goalsteps(void);
uint16_t pedometer_get_steps(void);
void pedometer_update_goal(uint16_t goal);
void pedometer_update_steps(uint16_t steps);
void bodyinfo_init(nv_watch_pedometer_setting_t* pedo_set);

/**********************
 *      MACROS
 **********************/

#define PEDOMETER_MAX_RECORD_COUNT     5
#define PEDOMETER_RECORD_LEN           sizeof(app_adaptor_pedometer_record_t) * PEDOMETER_MAX_RECORD_COUNT

#define NV_PEDOMETER_SETTING_LEN          sizeof(nv_watch_pedometer_setting_t)
#define NV_PEDOMETER_SETTING_OFFSET       0

#endif /*USE_LV_WATCH_PEDOMETER*/

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /*PEDOMETER_H*/
